<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkopwd() {
		var check=false;
		var o_pwd=document.getElementsByTagName("input")[0].value;
		 if (!o_pwd){
	       	 document.getElementById("result").innerHTML = "旧密码不能为空！";
		 	 check=false;
	    }else{
	        document.getElementById("result").innerHTML = "";
	    	check=true;
	    }
		 	return check;
	}
	function checknpwd(){
		var check=false;
		var pwd_n=document.getElementsByTagName("input")[1].value;
		var pwd_s=document.getElementsByTagName("input")[2].value;
		if(pwd_n!=pwd_s){
			 document.getElementById("result").innerHTML = "两次输入不一致";
			 check=false;
		}else{
			document.getElementById("result").innerHTML = "";
			 check=true;
		}
		return check;
	}
	function check() { 
		 var check = checkopwd() && checknpwd(); 
		 return check; 
	} 
</script>
</head>
<%
	String msg="";
	if(request.getAttribute("msg")!=null){
		msg=(String)request.getAttribute("msg");
	}
%>
<body>
	<h1>更新界面</h1>
	<form action="${pageContext.request.contextPath}/usermanager?method=updatepwd&id=<%=request.getParameter("id")%>" method="post" onsubmit="return check()">
		账号<input type="text" name="username">  </br>
		旧密码:<input type="password" name="oldpassword"><%=msg %><br>
		新密码:<input type="password" name="newpassword"><br>
		再次输入:<input type="password" onblur="checknpwd()" ><br>
		<span id="result" style="color:red"></span><br>
			 <input type="submit" value="修改">
	</form>
</body>
</html>